<!DOCTYPE html>
<html>
<head>
<title>菜单管理-修改</title>
#@head()
</head>
<body class="gray-bg">
	<div class="panel panel-default">
		<div class="panel-body">
			<div>

				<form class="form-horizontal" role="form" id="form" method="post" >
					<input type="hidden" name="bean.id" value="#(bean.id)">

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">上级菜单：</label>
						<div class="col-sm-8">
							<input id="" name="" class="form-control" type="text" value="#(parentName)" readonly>
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">类型</label>
						<div class="col-sm-8 i-checks">
							#for(item : typeList)
								<label class="radio-inline"> 
									<input type="radio" name="bean.type" value="#(item.value)" #if(bean.type==item.value) checked="checked" #end> #(item.name)
								</label> 
							#end
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">编码</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" name="bean.code" value="#(bean.code)" placeholder="请输入编码">
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">名称</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" name="bean.name" value="#(bean.name)" placeholder="请输入名称">
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">URL</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" name="bean.url" value="#(bean.url)" placeholder="请输入URL">
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">权限</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" name="bean.perms" value="#(bean.perms)" placeholder="请输入权限">
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">菜单图标</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" name="bean.icon" value="#(bean.icon)" placeholder="请输入菜单图标">
						</div>
					</div>

					<div class="form-group">
						<label for="firstname" class="col-sm-3 control-label">排序</label>
						<div class="col-sm-8">
							<input type="number" class="form-control" name="bean.orderNum" value="#(bean.orderNum)" placeholder="请输入排序">
						</div>
					</div>

					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-8">
							<button type="submit" class="btn btn-success">提交</button>
							<button type="button" class="btn default" onclick="cancel();">取消</button>
						</div>
					</div>

				</form>

			</div>
		</div>
	</div>
</body>
#@footer()

<script type="text/javascript">

$(function(){
	validateRule();
})

function save() {
	$.ajax({
		cache : true,
		type : "POST",
		url : "update",
		data : $('#form').serialize(),// 你的formid
		async : false,
		error : function(request) {
			parent.layer.alert("Connection error");
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg("操作成功");
				var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				parent.reLoad();
				parent.layer.close(index);

			} else {
				parent.layer.alert(data.msg)
			}
		}
	});

}
function validateRule() {
	var icon = "<i class='fa fa-times-circle'></i> ";
	$("#form").validate({
		submitHandler:function(e){
			save();
		}
	})
}

function cancel(){
	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	parent.layer.close(index);
}
</script>

</html>
